package com.example.rwq_test.designParttern.multiThread.future;

/**
 * TODO note
 *
 * @author renweiqiang
 * @version 1.0.0
 * @createTime 2022/11/15
 */
public class Host {
    public Data request(final int count, final char c) {
        System.out.println("request(" + count + "," + c + ") BEGIN");
        //创建FutureData的实例
        FutureData futureData = new FutureData();
        //启动新线程创建realData实例
        new Thread() {
            public void run() {
                RealData realData = new RealData(count, c);
                futureData.setRealData(realData);
            }
        }.start();
        System.out.println("request(" + count + "," + c + ") END");

        //返回futureData的实例
        return futureData;
    }
}
